#!/bin/bash

if [ $# != 1 ]; then
    echo "Usage: bash evaluate.sh <path/to/inference_results>"
    echo "[ERROR] Invalid arguments: $@"
    exit 1
fi

set -e

infer_results=`realpath $1`/
orig_data=`realpath data/dev-v1.1.json`

cd ./Bert_Base_Uncased_for_Pytorch
python3 bert_postprocess_data.py \
    --max_seq_length 384 \
    --vocab_file ./DeepLearningExamples/PyTorch/LanguageModeling/BERT/vocab/vocab \
    --do_lower_case \
    --predict_file ${orig_data} \
    --npu_result ${infer_results}

python3 evaluate_data.py ${orig_data} predictions.json
cd ..
